package com.wangyu.talents.core.config;

import com.github.pagehelper.PageHelper;
import java.util.Properties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * mybatis配置类
 *
 * @author wangyu
 * @Date 2018-09-03 16:15
 */
@Configuration
public class MybatisConfig {

  /**
   * 配置分页插件
   *
   * @author wangyu
   * @Date 2018/9/3 16:20
   */
  @Bean
  public PageHelper pageHelper() {
    System.out.println("MyBatisConfiguration.pageHelper()");
    PageHelper pageHelper = new PageHelper();
    Properties p = new Properties();
    p.setProperty("offsetAsPageNum", "true");
    p.setProperty("rowBoundsWithCount", "true");
    p.setProperty("reasonable", "true");
    pageHelper.setProperties(p);
    return pageHelper;
  }
}
